home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: in2.uu.net!utcsri!utgpu!utinfo!news
- From: normb@gpu.utcc.utoronto.ca
- Subject: Working with LoadSeg()
- X-Nntp-Posting-Host: control3.utcc.utoronto.ca
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <DMs687.9w2@utcc.utoronto.ca>
- Sender: news@utcc.utoronto.ca (News)
- Content-Transfer-Encoding: 7bit
- Organization: UTCC Campus Access
- Mime-Version: 1.0
- Date: Wed, 14 Feb 1996 19:31:18 GMT
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
-
- I'm still looking for a little light to be shed on
- working with loadseg()
-
- This section of code is from Ben Hutchings (thanks Ben)...
-
- > if( libseg = LoadSeg(libname) ) /* use _full_ pathname */
- > {
- > /* get pointer to embedded Resident structure */
- > libres = (struct Resident *)((LONG *)BADDR(libseg)+2);
- ^^^^^^
- This allways seems to work.
- >
- > /* check that it really is a library */
- > if( ((ULONG *)libres)[-1] != 0x70ff4e75 ||
- ^^^^^^^^^^
- This doesnt Allways work. Some valid libraries have this value.
- Any reason why I cant use the rt_Type Field and look for NT_LIBRARY??
-
- > libres->rt_MatchWord != RT_MATCHWORD ||
- ^^^^^^^^^^^^
- I guess you mean RTC_MATCHWORD
-
- > libres->rt_MatchPtr != (APTR)libres )
- > /* rt_MatchPtr is wrong - I forget the real name */
- I think this is rt_MatchTag and I've found that in most
- cases, if these pointers arent the same then I get bad data.
-
- > {
- > /* copy fields */
- > }
- > else
- > /* not a library */
- > UnLoadSeg(libseg);
- > }
-
- This code says to me that if any of these fields != then I have
- a valid library?? Can this be right.If I loadseg() say amigaguide.library
- then I get...
-
- libres[-1] == 0x70ff4e75,
- rt_MatchWord == RT_MATCHWORD
- rt_MatchPtr == (APTR)libres
-
- So that doesnt work.
-
-
- I also received the follwing from Martin Frost (thanks Martin)...
-
- > > ResLib=(struct Resident *)((LONG *)BADDR(LibSeg)+2);
- >
- > Don't you actually need
- >
- > for(ResLib=(struct Resident *)BADDR(LibSeg);
-
- Getting ResLib this way allways fails for me.
- Plus I Dont know why you have this in a for() loop.
-
- > ResLib->rt_MatchWord==0x4AFC && ResLib->rt_MatchPtr==ResLib;
- ^^^^^^^^^^^
- rt_MatchTag
- > (UWORD *)ResLib++);
- >
-
- In looking at the includes (exec/resident.h) the comment beside
- rt_MatchWord is /* word to match on (ILLEGAL) */ Does this mean
- its illegal to use this field??
-
-
- Thanks again for any and all help...
-
- Still many questions...isnt ignorance wonderfull!
-
- Norm.
-
- ---------------------------------------------------------------------
- Norman Baccari | "OK team! You start coding.
- normb@gpu.utcc.utoronto.ca | I'll go see what the user specs are."
- Toronto,Ontario,Canada |
- ---------------------------------------------------------------------
-
-
-
-